home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / windows / cm95_10.zip / INTERNET.DLL / TEXT / WILEUDORA < prev    next >
Text File  |  1996-10-29  |  3KB  |  142 lines

  1. AddExtender ("WXSock32i.dll")
  2. IntControl (35, 500, 0, 0, 0)
  3. bOK = @TRUE
  4. sDial     = "<dialupname>"
  5. nMaxRedial = <numredials>
  6. nRedialDelay = 10
  7. sPgmPath  = "<pgmpath>"
  8. sPgmDir   = "<pgmdir>"
  9. bGetMail   = <getmail>
  10. bSendMail  = <sendmail>
  11. bEmpty     = <empty>
  12. bCompact   = <compact>
  13. sErrDesc  = ""
  14.  
  15.  
  16. ;Dial our host (unless user is on a direct connect)...
  17. hConn = 0
  18. nNumRedials = 0
  19. if ((bGetMail || bSendMail) && sDial <> "")
  20.     :DialIt
  21.     hConn = DUNConnect (sDial)
  22.     nErr = SGetLastErr ()
  23.     if (!hConn)
  24.         switch nErr
  25.         case @SErrNotFound
  26.             sErrDesc = "Couldn't connect to %sDial%: no such dial-up"
  27.             break
  28.         case @SErrBusy
  29.             if (nNumRedials <= nMaxRedial)
  30.                 nNumRedials = nNumRedials + 1
  31.                 Delay (nRedialDelay)
  32.                 goto DialIt
  33.             else
  34.                 sErrDesc = "Couldn't connect to %sDial%: Line busy"
  35.             endif
  36.             break
  37.         case @SErrNoAnswer
  38.             if (nNumRedials <= nMaxRedial)
  39.                 nNumRedials = nNumRedials + 1
  40.                 Delay (nRedialDelay)
  41.                 goto DialIt
  42.             else
  43.                 sErrDesc = "Couldn't connect to %sDial%: No answer"
  44.             endif
  45.             break
  46.         case @SErrVoice
  47.             sErrDesc = "Couldn't connect to %sDial%: A human answered"
  48.             break
  49.         case nErr ; <--default
  50.             sErrDesc = "Couldn't connect to %sDial% - error %nErr%"
  51.         endswitch
  52.         bOK = @FALSE
  53.         goto LogIt
  54.     else
  55.         if (nErr == @SAlready)
  56.             ; We're already connected. Don't hang up when this event is thru...
  57.             hConn = 0 
  58.         endif
  59.     endif
  60. endif
  61.  
  62.  
  63. ;Activate or Run Eudora...
  64. If WinExist("Eudora")
  65.     WinActivate("Eudora")
  66. else
  67.     DirChange (sPgmDir)
  68.     Run(sPgmPath, "")
  69. endif
  70.  
  71.  
  72. ; Do stuff online...
  73. :GetMail
  74. if bGetMail
  75.     SendKeysTo("Eudora", "!FM")
  76.     while !WinExist("No New Mail") && !WinExist("New Mail!")
  77.         Delay(5)
  78.         MouseMove (100+random(10), 100, "", "")
  79.     endwhile
  80.     Delay(1)
  81.     SendKeysTo("Eudora", "~")
  82. endif
  83.  
  84.  
  85. :SendMail
  86. if bSendMail
  87.     SendKeysTo("Eudora", "!FQ")
  88.     while WinExist("Progress")
  89.         Delay(5)
  90.         MouseMove (100+random(10), 100, "", "")
  91.     endwhile
  92.     Delay(1)
  93. endif
  94.  
  95.  
  96. ; Do stuff offline...
  97. :Compact
  98. if bCompact
  99.     SendKeysTo("Eudora", "!ST")
  100.     while WinExist("Progress")
  101.         Delay(5)
  102.         MouseMove (100+random(10), 100, "", "")
  103.     endwhile
  104.     Delay(1)
  105. endif
  106.  
  107.  
  108. :Empty
  109. if bEmpty
  110.     SendKeysTo("Eudora", "!SE")
  111.     while WinExist("Progress")
  112.         Delay(5)
  113.         MouseMove (100+random(10), 100, "", "")
  114.     endwhile
  115.     Delay(1)
  116. endif
  117.  
  118.  
  119. ; If user hit Ctrl+Break, WIL will bring us here...
  120. :Cancel
  121.  
  122. ; Hang up...
  123. :HangUp
  124. if (hConn)
  125.     nRet = DUNDisconnect (hConn)
  126. endif
  127.  
  128.  
  129. ; Log what we did...
  130. :LogIt
  131. if bOK == @TRUE
  132.     sLog = "Ran Eudora"
  133. else
  134.     sLog = strcat ("Error automating Eudora:", @CRLF, sErrDesc)
  135. endif
  136.  
  137. CMLogMessage (sLog)
  138. Display (8, "ClockMan95", sLog)
  139. exit
  140.  
  141. ~
  142.